﻿using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations.Schema;
using System.Data.Entity.Infrastructure.Annotations;
using System.Data.Entity.ModelConfiguration;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace EfSandbox.Entities.Final.Common.Mappings {
    public class OptionTypeMap : EntityTypeConfiguration<OptionType> {
        public OptionTypeMap() {
            // Table
            //ToTable("fin.com_categories");

            // Primary Key
            HasKey(o => o.OptionTypeId);

            // Index
            Property(f => f.CategoryCode)
                .HasColumnAnnotation(IndexAnnotation.AnnotationName, new IndexAnnotation(new IndexAttribute("IX_CAT_OTT_CD", 1) { IsUnique = true }));
            Property(f => f.OptionTypeId)
                .HasColumnAnnotation(IndexAnnotation.AnnotationName, new IndexAnnotation(new IndexAttribute("IX_CAT_OTT_CD", 2) { IsUnique = true }));

            // Attributes
            Property(c => c.OptionTypeId)
                .HasColumnName("cat_ott_id");
        }
    }
}
